using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;  

namespace hosted_gmail_client {
   public partial class Logout:Form {
      private int _service;

      public Logout(int service) {
         _service = service;
         InitializeComponent();
      }

      private void Logout_Load(object sender,EventArgs e) {
         RegistryKey key = Common.GetRegistryKey(false);
         if (_service == 1) {
            wbLoggingOut.Navigate("http://mail.google.com/hosted/" + key.GetValue("emailaddress").ToString().Split(Char.Parse("@"))[1] + "/?logout&hl=en&zx=6vwqg1-uwiyfb");
         } else if (_service == 2) {
            wbLoggingOut.Navigate("http://www.google.com/calendar/hosted/" + key.GetValue("emailaddress").ToString().Split(Char.Parse("@"))[1] + "/logout");
         }
      }

      private void wbLoggingOut_DocumentCompleted(object sender,WebBrowserDocumentCompletedEventArgs e) {
         this.DialogResult = DialogResult.OK;
      }
   }
}